package start;

import java.util.Date;

import javax.sql.DataSource;

public class JdbcActorDAO implements ActorDAO {

    private ActorMappingQuery actorMappingQuery;
    private UpdateActorBirthName updateActorBirthName;

    public void setDataSource(DataSource dataSource) {
        this.actorMappingQuery = new ActorMappingQuery(dataSource);
        this.updateActorBirthName = new UpdateActorBirthName(dataSource);
    }
    public Actor getActor(Long id) {
        return actorMappingQuery.findObject(id);
    }
    public void updateActorBirthName(int id, Date birthDate) {
        updateActorBirthName.execute(id, birthDate);
    }
}
